import { createRouter, createWebHistory } from 'vue-router'
// 组件导入
import Layout from '@/views/layout/index.vue'
import CategoryView from '@/views/category/index.vue'
import UserView from '@/views/user/index.vue'
import UserLoginView from '@/views/user/login.vue'
import IndexView from '@/views/index/index.vue'
import NurseplanView from'@/views/nurseplan/index.vue'
import NurselevelView from'@/views/nurselevel/index.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/user/login' // 重定向到登录页面
    },
    {
      path: '/user/login',
      name: 'userLogin',
      component: UserLoginView
    },
    {
      path: '/',
      name: 'layout',
      component: Layout,
      children:[
        {path:'/',redirect:'/index'},
        {path:'/index',name:'index',component:IndexView},
        {path:'/category',name:'category',component:CategoryView},
        {path:'/user',name:'user',component:UserView},
        {path:'/nurseplan',name:'nurseplan',component:NurseplanView},
        {path:'/nurselevel',name:'nurselevel',component:NurselevelView}
      ]
    },{path:'/user/login',name:'userLogin',component:UserLoginView}
  ],
})

export default router
